<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
<head>
    <base href="<%=basePath%>">
    <meta charset="utf-8">
    <title>病案首页预览</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">


    <script type="text/javascript" src="assets/jquery/jquery.min.js"></script>

    <link rel="stylesheet" href="assets/layui/css/layui.css" media="all" />

    <style>

        /* 栅格示例 */
        .grid-demo{
            padding: 5px; line-height: 30px; text-align: center; background-color: #fff; color: #333;
        }
        .grid-demo-bg1{background-color: #fff;border: 1px solid #333;line-height: 30px; height: 30px;}
        .grid-demo-bg2{background-color: #fff;border: 1px solid #333;line-height: 30px;}
        .grid-demo-bg3{background-color: #fff;border: 1px solid #333;line-height: 30px;}

        .layui-input{
            border: none;
            border-bottom: 2px solid #009688;
            height: 30px;
        }
        .layui-form-item{
            margin-bottom: 5px;
        }
        .layui-form-item .layui-inline{
            padding: 9px 0px;
            margin-right: 2px;
        }
        .layui-form-label{
            padding: 9px 0px;
            font-weight: bold;
        }
        .layui-form-item .layui-input-inline{
            margin-right: 5px;
        }


       .layui-form-radio i {
            top: 0;
            width: 16px;
            height: 16px;
            line-height: 16px;
            border: 1px solid #d2d2d2;
            font-size: 12px;
            border-radius: 2px;
            background-color: #fff;
            color: #fff !important;
        }
        .layui-form-radioed i {
            position: relative;
            width: 18px;
            height: 18px;
            border-style: solid;
            background-color: #6A8BF5;
            color: #6A8BF5 !important;
        }
        /*!* 使用伪类画选中的对号 *!*/
        .layui-form-radioed i::after, .layui-form-radioed i::before {
            content: "";
            position: absolute;
            top: 8px;
            left: 5px;
            display: block;
            width: 12px;
            height: 2px;
            border-radius: 4px;
            background-color: #fff;
            -webkit-transform: rotate(-45deg);
            transform: rotate(-45deg);
        }
        .layui-form-radioed i::before {
            position: absolute;
            top: 10px;
            left: 2px;
            width: 7px;
            transform: rotate(-135deg);
        }

    </style>

</head>

<body class="layui-layout-body">
<!-- 页面加载loading -->
<div class="page-loading">
    <div class="ball-loader">
        <span></span><span></span><span></span><span></span>
    </div>
</div>
<!-- 正文开始 -->

    <form id="infoListForm" class="layui-form">
        <input type="hidden" id="visitGuid" value="${visitGuid}">
       
         <div class="layui-row">
			    <div class="layui-col-xs2">
			      <div class="grid-demo"></div>
			    </div>
			     <div class="layui-col-xs8">
			       <div class="layui-card">
	                <div class="layui-card-header" style="background-color: #009688;font-weight: bold;color:#FFF;">病案首页</div>
	                <div class="layui-card-body">
	                    <div class="layui-row">
	                        <div id="showImg" style="border:1px solid red;margin:0px auto;width:100%;height:850px;overflow: auto;" style="text-align: center" class="layui-carousel layadmin-carousel layadmin-dataview" data-anim="fade" lay-filter="LAY-index-pagetwo">
	                              <iframe id="pdfIframe" style="width:100%;height:100%"  src=""></iframe>
	                        </div>
	                    </div>
	                </div>
	            </div>
			    </div>
			    <div class="layui-col-xs2">
			      <div class="grid-demo"></div>
   		 </div>
        	
       
    </form>

</div>

<script type="text/javascript" src="assets/layui/layui.js"></script>
<!-- js部分 -->
<script type="text/javascript">


    layui.use(['form','layer','layedit','laydate','upload','element', 'table'],function(){
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer,
            laypage = layui.laypage,
            upload = layui.upload,
            layedit = layui.layedit,
            laydate = layui.laydate,
            element = layui.element;
        table = layui.table;
        $ = layui.jquery;

        

        // 根据手术申请id生成base64打印信息
        window.init = function(){
            var visitGuid = $("#visitGuid").val();
            $.ajax({
                url:"${pageContext.request.contextPath }/shandong/generateHomepagePDF",
                type:"post",
                data:{visitGuid:visitGuid},
                success:function(res){
                console.log(res);
                    if(res.success){
						$("#pdfIframe").attr("src",res.data)
                     
                    }else{
                        layer.msg(res.msg);
                        return false;
                    }
                }
            })
        }

        $(function(){
            var visitGuid = $("#visitGuid").val();
           init();
        })



      

    });





    $.each($(".doctor_select"),function(i,item){
        $(item).autocomplete({
            source: function(request, response) {
                $.ajax({
                    url: "ward/getStdHospitalManInfoByKeyword",
                    dataType: "json",
                    data : {
                        "keycode" : request.term
                    },
                    cache : false,
                    success: function(data) {
                        console.log("data:"+JSON.stringify(data));
                        //返回的data为List<Address(Long id, String address)>
                        response( $.map(data, function( item ) {
                            return {
                                label:item.name+"["+item.jobNumber+"]",
                                uniq_code:item.idCard,
                                uniq_name:item.name,
                                value:item.name
                            }
                            console.log(item);
                        }));
                    },
                    error : function(suggestionRequest, textStatus, error) {
                        alert(error);
                    }
                });
            },
            minLength: 1,
            select: function( event, ui ) {

                var eventObj = $(this);
                var item = ui.item;
                console.log("uniq_code:"+JSON.stringify(item));
                var codeObjName = eventObj.attr("key");
                eventObj.next("input[name='"+codeObjName+"']").val("").val(item.uniq_code);
            },search: function( event, ui ) {
                console.log(ui);
                var eventObj = $(this);
                var codeObjName = eventObj.attr("key");
                //eventObj.next("input[name='"+codeObjName+"']").val(item.uniq_code);
                /* eventObj.next("input[data-code='search_input1']").val(""); */
                //var codeObjName = eventObj.attr("name").replace("Name", "Code");
                //eventObj.next("input[name='"+codeObjName+"']").val("");
            }
        });

    });



    function closeBasic(){
        var index = top.layer.msg('正在关闭，请稍候',{icon: 16,time:false,shade:0.8});

        setTimeout(function(){
            top.layer.close(index);
            layer.closeAll("iframe");
            //刷新父页面
            parent.location.reload();
        },500);

        return false;
    }

    function isNumber(val,length) {

        if(val.length>length){
            return false;
        }

        var regPos = /^\d+(\.\d+)?$/; //非负浮点数
        var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
        if(regPos.test(val) || regNeg.test(val)) {
            return true;
        } else {
            return false;
        }
    }


    //时间戳转日期
    function dateFormat(timeStamp) {
        var date = new Date(timeStamp);
        var y = date.getFullYear();
        var m = date.getMonth() + 1;
        m = m < 10 ? '0' + m : m;
        var d = date.getDate();
        d = d < 10 ? ("0" + d) : d;
        var h = date.getHours();
        h = h < 10 ? ("0" + h) : h;
        var M = date.getMinutes();
        M = M < 10 ? ("0" + M) : M;
        var S = date.getSeconds();
        S = S < 10 ? ("0" + S) : S;
        var str = y + "-" + m + "-" + d + " " + h + ":" + M + ":" + S;
        return str;
    }



</script>
</body>
</html>
